<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;



class RegisterController extends Controller
{


	public function index(){
		return view('user.register');
	}


    public function store(Request $request){

    	$this->validate($request, [
    		'username' => 'required|unique:users|min:3',
    		'password' =>'required',
    		
    	]);
    	


    	$data = new User;
    	$data->username = $request->username;
    	$data->password = bcrypt($request->password);
    	$data->name = $request->name;
    	$data->wechat = $request->wechat;
    	$data->qq = $request->qq;
    	$data->mobile = $request->mobile;
    	$data->email = $request->email;
    	$data->edu = $request->edu;
    	$data->birthday = $request->birthday;
    	$data->sex = $request->sex;
    	$data->intro = $request->intro;
    	$data->save();
    }
}
